define(function(require, exports){
	var $ = require('jquery');
	var pubjs = require('pubjs');
	var util = require('util');
	var baseGrid = require('@base/grid').baseNoDate;

	var Base = baseGrid.extend({
		init: function(config){
			config = pubjs.conf(config, {
				'cols': [
					{"type": "op", "render": 'renderOp'}
					,{"name":"_id", "text": LANG('ID')}
					,{"name": "type", "text": LANG('type(字段类型)'), render: 'renderType'}
					,{"name": "title", "text": LANG('title')}
					,{"name": "description","text":LANG("description(描述)"),"width":210}
					,{"name": "field","text":LANG("field(字段名)"),"width":210}
					,{"name": "height","text":LANG("height"),"width":210}
					,{"name": "width","text":LANG("width"),"width":210}
					,{"name": "max","text":LANG("max(最大长度)"),"width":210}
					,{"name": "min","text":LANG("max(最小长度)"),"width":210}
					,{"name": "defaultValue","text": LANG("defauleValue(默认值)"),"width":210}
					,{"name": "extensions","text": LANG("extensions(扩展名)"),"width":210}
					,{"name": "limit","text": LANG("limit(素材大小,kb)"),"width":210}
					,{"name": "notRequired", "type": "index", "text":LANG("notRequired(是否必填，针对图片)"),"width":210, render: 'renderBool'}
				]
				,"opClick": true
				,'hasSearch': false
				,'hasTab': false
				,'hasExport': false
				,'hasAmount': false
				,'hasRefresh': true
				,'url': 'ptc/list'
				,'sub_field': '_id'
				,'reqType': 'websocket'
				,'pager': {'size':10}
				,'param' :{
					'Type': 3,
					'noAmount': true
				}
			});

			this.Super('init', arguments);
		}
		,renderBool: function(data, val) {
			return String(!!val);
		}
		,renderType: function(data, val) {
			var ret = LANG('未知');
			switch (val){
				case 1:
					ret = LANG('文字类型');
					break;
				case 2:
					ret = LANG('图片类型');
					break;
				case 3:
					ret = LANG('隐藏类型');
					break;
				case 4:
					ret = LANG('Radio类型');
					break;
				case 5:
					ret = LANG('Video类型');
					break;
			}

			return ret;
		}
		,renderOp: function(a, b, data) {
			var op = [
				'<a data-op="edit" title="'+LANG("编辑记录")+'">'+LANG("编辑记录")+'</a>'
				,'<a data-op="del" title="'+LANG("删除记录")+'">'+LANG("删除记录")+'</a>'
			];

			if(data.IsDeleted) {
				op.push('<a data-op="recover" title="'+LANG("恢复")+'">'+LANG("恢复")+'</a>');
			}
			else {
				op.push('<a data-op="hide" title="'+LANG("隐藏字段")+'">'+LANG("隐藏字段")+'</a>');
			}

			return op.join('|')
		}
	});

	exports.base = Base;

});